<template>
	<div>
		<Card class="content-card">
			<Tabs :animated="false">
				<ButtonGroup slot="extra">

				</ButtonGroup>
				<TabPane label="租车列表" name="give">
					<div style="margin-bottom:10px;">

					</div>
					<table-view ref="tableView" :tableCol='tableCol' :params='params' :requestUrl='requestUrl'></table-view>
				</TabPane>
			</Tabs>
		</Card>

	</div>
</template>

<script>
	import tableView from '../../components/table'
	import {
		formatDate
	} from '../utils/time.js'
	export default {
		components: {
			tableView
		},
		data() {
			return {
				requestUrl: '/rent/give/list',
				tableCol: [{
						title: '序号',
						type: 'index',
						width: 70
					}, {
						title: '设备要求',
						key: 'equipmentNeeds',
						minWidth: 150

					}, {
						title: '工况介绍',
						minWidth: 150,
						key: 'situation'
					}, {
						title: '施工地址',
						minWidth: 120,
						render: (h, params) => {
							return h('div', params.row.provinceName + params.row.cityName + params.row.address)
						}
					},{
						title: '数量',
						minWidth: 50,
						key: 'number',
					}, {
						title: '规格',
						minWidth: 80,
						key:'specifications'
					}, {
						title: '编号',
						minWidth: 100,
						key:'serialNumber'
					},{
						title: '联系人',
						minWidth: 80,
						render: (h, params) => {
							return h('div', params.row.user.realName)
						}
					}, {
						title: '手机号',
						minWidth: 100,
						render: (h, params) => {
							return h('div', params.row.user.userTel)
						}
					}, {
						title: '发布日期',
						minWidth: 120,
						key: 'createTime',
						render: (h, params) => {
							return h('div', formatDate(new Date(params.row.createTime), 'yyyy-MM-dd hh:mm'))
						}
					}, {
						title: '截止日期',
						minWidth: 120,
						key: 'createTime',
						render: (h, params) => {
							return h('div', formatDate(new Date(params.row.deadlineTime), 'yyyy-MM-dd hh:mm'))
						}
					}, {
						title: '操作',
						key: 'action',
						minWidth: 100,
						render: (h, params) => {
							return h('div', [
								h('Button', {
									props: {
										type: 'error',
										size: 'small'
									},
									style: {
										marginLeft: '10px'
									},
									on: {
										click: () => {
											this.$Modal.confirm({
												title: '删除？',
												content: '确定要删除吗？删除不可恢复',
												onOk: () => {
													this.$http.post('/rent/give/delete', {
														id: params.row.giveId
													}).then(res => {
														if (res.status == 200) {
															this.$refs['tableView'].getData()
															this.$Notice.warning({
																title: '删除成功'
											
															});
														}
													})
												}
											})
										}
									}
								}, '删除')
							])
						}
					}

				],
				  params:{
				    pageNo:1,
				    pageSize:10
				},
				modalType: ''
			}
		},
		mounted() {

		},
		methods: {
			refreshData() {
				this.$refs['tableView'].getData()
			},
			operationDone() {
				this.$refs['tableView'].getData()
			}
		}
	}
</script>

<style>
</style>
